import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

import Index from '@/components/Index'
import Login from '@/components/Login'
import Regist from '@/components/Regist'
import Menus from '@/components/index/Menus'
import Welcome from '@/components/Welcome'
import Users from '@/components/index/Users'
import Mine from '@/components/index/Mine'
import Happy from '@/components/index/Happy'
import Outlines from '@/components/index/Outline'
import Items from '@/components/index/Items'
import Count from '@/components/index/Count'
import Classes from '@/components/index/Classes'
import Papers from '@/components/index/Papers'
import PapersAdd from '@/components/index/PapersAdd'
import PapersList from '@/components/index/PapersList'
import PapersEdit from '@/components/index/PapersEdit'
import Publish from '@/components/Publish'
import Thank from '@/components/Thank'
export default new Router({
  routes: [{
      path: '/',
      redirect: '/index/happy'
    },
    {
      path:'/publish/:paper_id',
      name:'publish',
      props:true,
      component:Publish
    },
    {
      path: '/index',
      name: 'index',
      redirect: '/index/happy',
      component: Index,
      children: [
        {
          path: 'papers/add',
          name:'papersadd',
          component: PapersAdd
        },
        {
          path: 'papers/edit/:id',
          props:true,
          name:'papersedit',
          component: PapersEdit
        },
        {
          path: 'papers/list',
          name:'paperslist',
          component: PapersList
        },
        {
          path: 'menus',
          component: Menus
        },
        {
          path: 'happy',
          component: Happy
        },
        {
          path: 'users',
          component: Users,
        },
        {
          path: 'mine',
          component: Mine,
        },
        {
          path: 'outlines',
          component: Outlines
        },
        {
          path: 'classes',
          name: 'classes',
          component: Classes
        },
        {
          path: 'items',
          name: 'items',
          component: Items
        },
        {
          path: 'count/:paper_id',
          props:true,
          name: 'count',
          component: Count
        },
        {
          path: 'papers',
          redirect: '/index/papers/list',
          component: Papers,
          children: [{
              path: 'list',
              component: {
                template: '<div>list</div>'
              }
            },
            {
              path: 'add',
              component: {
                template: '<div>hello</div>'
              }
            }
          ]
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/regist',
      name: 'regist',
      component: Regist
    },
    {
      path: '/welcome',
      name: 'welcome',
      component: Welcome
    },
    {
      path: '/thank',
      name: 'thank',
      component: Thank
    },
  ]
})
